package local.blueheart.data.springdatademo.listener;

import local.blueheart.data.springdatademo.service.TaskService;
import local.blueheart.data.springdatademo.util.QuartzManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Order(value = 1)
public class ScheduleJobInitListener implements CommandLineRunner {

    private static final Logger LOGGER = LoggerFactory.getLogger(ScheduleJobInitListener.class);

    @Autowired
    TaskService taskService;

    @Autowired
    QuartzManager quartzManager;

    @Override
    public void run(String... args) throws Exception {
        LOGGER.info("======ScheduleJobInitListener Start =======");
        taskService.initSchedule();
    }
}
